package app.modules.cloudpivot.configuration;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.authine.cloudpivot.app.api.facade.ApplicationFacade;
import com.authine.cloudpivot.app.permission.spi.DataPermissionRuntimeService;
import com.authine.cloudpivot.engine.api.facade.ModelManagementFacade;
import com.authine.cloudpivot.engine.api.facade.OrganizationFacade;
import com.authine.cloudpivot.engine.api.facade.PermissionManagementFacade;

import app.modules.cloudpivot.permission.CustomDataPermissionRuntimeServiceImpl;

@Configuration
public class CustomAppPermissionConfiguration {
    @Autowired
    private ApplicationFacade applicationFacade;
    @Autowired
    private PermissionManagementFacade permissionManagementFacade;
    @Autowired
    private OrganizationFacade organizationFacade;
    @Autowired
    private ModelManagementFacade modelManagementFacade;

    @Bean
    public DataPermissionRuntimeService dataPermissionRuntimeService() {
        return new CustomDataPermissionRuntimeServiceImpl(this.applicationFacade, this.permissionManagementFacade, this.organizationFacade,
                this.modelManagementFacade);
    }
}